/**
 * 
 */
package com.zhiteng.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.zhiteng.entity.Parent;
import com.zhiteng.mapper.ParentMapper;

/**  
* <p>Title: ParentServiceImpl.java</p>  
* <p>Description:家长Service </p>  
* @author dragon  
* @date 2018年12月19日  
* @version 1.0  
*/
@Controller
public class ParentServiceImpl implements ParentService {
	@Autowired
	private ParentMapper parentMapper;

	@Override
	public int saveBatch(List<Parent> allParentList) {
		int count = 0;
		for (Parent parent : allParentList) {
			if(parentMapper.existsWithPrimaryKey(parent.getUserid())) {
				parentMapper.updateByPrimaryKeySelective(parent);
			}else {
				parentMapper.insertSelective(parent);
			}
			count++;
		}
		return count;
	}
}
